package br.gov.ms.tce.modelo.bean;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;


/**
*  @class Municipio
 * @author Anderson Paulino
 * @date 28/05/2011
 *
 */
@Entity
@Table( schema = "comum", name = "municipio", uniqueConstraints = @UniqueConstraint(columnNames = {
		"cod_uf", "descricao" }))
public class Municipio implements java.io.Serializable {

	/**
	 * serialVersionUID
	 */
	private static final long serialVersionUID = 6993547803936319165L;
	private int id;
	private Uf uf;
	private String descricao;
	private boolean municipal;
	
	public Municipio() {
	}

	public Municipio(int id, Uf uf, String descricao, boolean municipal) {
		this.id = id;
		this.uf = uf;
		this.descricao = descricao;
		this.municipal = municipal;
	}	
	
	/**
	 * @return Obtém o valor da propriedade id
	 */
	@Id
	@Column(name = "cod", unique = true, nullable = false)
	public int getId() {
		return id;
	}

	/**
	 * @param id configura a propriedade id
	 */
	public void setId(int id) {
		this.id = id;
	}

	@ManyToOne
	@JoinColumn(name = "cod_uf", nullable = false)
	public Uf getUf() {
		return this.uf;
	}

	public void setUf(Uf uf) {
		this.uf = uf;
	}
	
	/**
	 * @return Obtém o valor da propriedade descricao
	 */
	@Column(nullable = false)
	public String getDescricao() {
		return descricao;
	}

	/**
	 * @param descricao configura a propriedade descricao
	 */
	public void setDescricao(String descricao) {
		this.descricao = descricao;
	}

	@Column(name = "municipal", nullable = false)
	public boolean isMunicipal() {
		return this.municipal;
	}

	public void setMunicipal(boolean municipal) {
		this.municipal = municipal;
	}

}
